
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using GruntXProductions;
using Viper;
using Viper.Opcodes;

namespace Diamond
{
	public partial class CodeGen 
	{
		public void ParseWhile(WhileStatement ifstat)
		{
			string label = "while_" + ifIndex.ToString();
			string label2 = "endwhile_" + ifIndex.ToString();
			ifIndex++;
			Assembler.CreateLabel(label);
			ParseBooleanExpression(ifstat.Comparison);
			Assembler.Emit(new bz(label2));
			CompileBlock(ifstat.Body);
			Assembler.Emit(new bra(label));
			Assembler.CreateLabel(label2);
		}
	}
	
}